<extend name="Index:base" />
<block name="title"><title>订单列表</title></block>
<block name="style">
 <style>
.main,.panel-default>.panel-heading{
background:none;
}
body{
background:none;
}
.panel.panel-default,.panel .panel-body,.panel .panel-heading,.table-bordered {
	border:none;
}
.table-bordered > thead > tr > th, .table-bordered > tbody > tr > th, .table-bordered > tfoot > tr > th, .table-bordered > thead > tr > td, .table-bordered > tbody > tr > td, .table-bordered > tfoot > tr > td {
	border:none;		
	padding:15px 0 15px 0;	
	line-height:8px;
	height: 8px;
	border-top: 1px solid #d4d4d4;
	border-bottom: 1px solid #d4d4d4;
}
.name strong{
color:#000000;
font-size:15px;
font-weight:600;
}
.name {
	color:#20a8d8;
	font-size:12px;
}
.smallfont {
	color:#9c9c9c;
	font-size:12px;
}

.align-center{
	text-align:center; 
}
.title2{
text-align:center;
}
.table-bordered > tbody > tr .wd{
	text-align:left;	
}

.col-xs-2,.col-xs-4{
padding-right:0;
margin:10px 0;
}
.col-sm-3{
width:10%;
}
.col-sm-2{
width:8%;
}
.col-sm-1{
width:5%;
}
.col-sm-4{
width:18%;
}
.col-sm-1,.col-sm-2{
margin:16px 0;
}
.col-sm-3,.col-sm-4{
margin:10px 0;
}
.col-sm-1,.col-sm-2,.col-sm-3,.col-sm-4{
padding-right:0;
}
 </style>
 
    <link type="text/css" href="__PUBLIC__/Home/css/jquery-ui-1.8.17.custom.css" rel="stylesheet" />
     <link type="text/css" href="__PUBLIC__/Home/css/jquery-ui-timepicker-addon.css" rel="stylesheet" />
	 
</block>
	<!-- start: Header -->
<block name="body">

			<!-- end: Main Menu -->
						
		<!-- start: Content -->
		<div class="main ">
		
			<div class="row">
				<div class="col-lg-12">
					<h3 class="page-header"><i class="fa fa-life-bouy"></i>订单列表</h3>
				</div>
			</div>

			<div class="row">		
				<div class="col-lg-12">
					<div class="panel panel-default">
						<div class="panel-heading">
							<h2><span class="break"></span><strong>订单列表</strong></h2>
												
						</div>&nbsp;&nbsp;&nbsp;
						<ol class="breadcrumb" style="height:55px;background-color: #ffffff;">							
							<li><i class="fa fa-warning"></i><a href="#">操作提示：</a></li><br/>	
							<li><font style="font-size:8px;color:#888;">新增店铺操作时，当店主账号为已存在的会员账号，则该新增店铺为管理员通过后台帮助该会员开启店铺功能，该新店铺为该会员所有！</font></li>							
						</ol>
						<div class="panel-body">
							<!--搜索 开始-->
							<form method="get" name="formSearch" id="formSearch">
								<input type="hidden" id="select" name="select" value="s_order">
				               <div class="col-md-12" style="background-color:#f5f5f5;padding:0;">
								<div class="form-group" style="width:100%;">
									<label class="col-sm-1 control-label" for="input-small">订单号</label>
									<div class="col-sm-4">
				                        <input type="text" id="order_sn" name="order_sn" class="form-control" >
				                    </div>	
									<label class="col-sm-1 control-label" for="input-small">店铺</label>
									 <div class="col-sm-3">
									<input type="text" id="st_name" name="st_name" class="form-control">
				                    </div>									
									<label class="col-sm-2 control-label" for="input-small">订单状态</label>
									<div class="col-sm-3">
									   <select name="order_state" class="form-control">
										  <option value="">请选择</option>
										  <option value="10">待付款</option>
										  <option value="20">待发货</option>
										  <option value="30">待收货</option>
										  <option value="40">交易完成</option>
										  <option value="1">已取消</option>
										</select>
				                    </div>
<!-- 									<label class="col-sm-2 control-label" for="input-small">付款方式</label>
									<div class="col-sm-3">
										<select name="payment_code" class="form-control">
											<option value="">请选择</option>
											<option value="alipay">支付宝</option>
											<option value="tenpay">财付通</option>
											<option value="wxpay">微信支付</option>
										</select>
				                    </div> -->
				                </div>
				               </div>
				               <div class="col-md-12" style="background-color:#f5f5f5;padding:0;">
								<div class="form-group" style="width:100%;">
									<label class="col-sm-2 control-label" for="input-small">下单时间</label>
									<div class="col-sm-4">
				                        <input type="text" id="start_time" name="start_time" class="form-control ui_timepicker2" >
				                    </div>	
									<label class="col-sm-1 control-label" style="width:25px;">
									至
									</label>
									 <div class="col-sm-4">
									<input type="text" id="end_time" name="end_time" class="form-control ui_timepicker2">
				                    </div>									
									<label class="col-sm-2 control-label" for="input-small">买家</label>
									<div class="col-sm-3">
										<input type="text" id="buyer_name" name="buyer_name" class="form-control" >
				                    </div>
				                    <div class="col-sm-3">
										<button type="submit" class="btn btn-primary">搜索</button>
				                    </div>
				                </div>
				               </div>				                    
							  </form>
							  <!--搜索 结束-->
							<table class="table table-striped table-bordered bootstrap-datatable datatable">
							  <thead>
								  <tr>
                                      <th>订单号</th>
									  <th class="title2">店铺</th>
									  <th class="title2">买家</th>
									  <th class="title2">下单时间</th>
									  <th class="title2">订单总额</th>
									  <th class="title2">支付方式</th>
									  <th class="title2">订单状态</th>
									  <th class="title2">操作</th>
								  </tr>
							  </thead>   
							  <tbody id="state">
								<volist name="list" id="vo">
								<tr>
									<td class="wd">
										{$vo.order_sn}
									</td>
									 <td class="align-center">{$vo.store_name}</td>
									 <td class="align-center">{$vo.buyer_name}</td>
									 <td class="align-center">{$vo.add_time|=date('Y-m-d H:i:s',###)}</td>
									 
									<td class="align-center">
									<if condition="$vo.order_amount gt 0">
									￥{$vo.order_amount}
									</if>
									<if condition="$vo.points_amount gt 0">
									<if condition="$vo.order_amount gt 0">
									+
									</if>
									{$vo.points_amount}&nbsp;积分
									</if>
									<if condition="$vo.gold_amount gt 0">
									{$vo.gold_amount}&nbsp;币
									</if>
									</td>
									<td class="align-center">{$vo.pay_name}</td>
									<td class="align-center">
									<if condition="$vo.order_state eq '10'"><font style="color:red;">待付款</font></if>
									<if condition="$vo.order_state eq '20'">待发货</if>
									<if condition="$vo.order_state eq '30'"><font style="color:#0493c5;">待收货</font></if>
									<if condition="$vo.order_state eq '40'">已发货</if>
									<if condition="$vo.order_state eq '0'">取消</if>
									
										<if condition="$vo.status eq '4'">待退款</if>
										<if condition="$vo.status eq '5'">已完成</if>
										<if condition="$vo.status eq '6'">已退款</if>
										
									</td>
									<td class="align-center">
										<a href="{:U('Trade/index')}?atc=order_info&order_id={$vo.order_id}" data-id="{$vo.order_id}">					
										&nbsp;&nbsp;<span class="label label-success" >查看</span>
										</a>	
										<if condition="$vo.status neq '0'">
										<a href="#" data-id="{$vo.order_id}" data-type="off"  data-state="1">					
										&nbsp;&nbsp;<span class="label label-danger">取消</span>
										</a>
																				
										<a href="#" data-type="take" data-id="{$vo.order_id}" data-state="21">					
										&nbsp;&nbsp;<span class="label label-info">收到货款</span>
										</a>
										</if>
									 </td>

								</tr>
								</volist>
							  </tbody>
						  </table>  
							<ul class="pagination">
								{$page}
							 </ul>						  
						</div>
					</div>
				</div><!--/col-->
			
			</div><!--/row-->				
			
		<!-- end: Content -->
		<br><br><br>
		
	</div><!--/container-->
		
</block>
<block name="script">
	<script type="text/javascript" src="__PUBLIC__/Home/js/jquery-1.7.1.min.js"></script>	
	<script type="text/javascript" src="__PUBLIC__/Home/js/jquery-ui-1.8.17.custom.min.js"></script>
	<script type="text/javascript" src="__PUBLIC__/Home/js/jquery-ui-timepicker-addon.js"></script>
    <script type="text/javascript" src="__PUBLIC__/Home/js/jquery-ui-timepicker-zh-CN.js"></script>
<script>
    $(function () {
        $(".ui_timepicker2").datetimepicker({
            //showOn: "button",
            //buttonImage: "./css/images/icon_calendar.gif",
            //buttonImageOnly: true,
            showSecond: true,
            timeFormat: 'hh:mm:ss',
            stepHour: 1,
            stepMinute: 1,
            stepSecond: 1
        });
		$("[data-type='off']").click(function(){

			var id = $(this).attr('data-id');
			var state = $(this).attr('data-state');
			//alert(id);
			if (id) {
				if(confirm("确定要取消订单吗？")){
					$.ajax({
						url:"{:U('Trade/order_off')}",
						data:{id:id,state:state,type:'order_off'},
						type:'post',
						dataType:'json',
						success:function (e) {			
						//alert(id);
							alert(e.info); 
							location.reload();				
						}
					});											
				}else{

				//否
				return false;

				}

			} 

		});
		//收到货款
		$("[data-type='take']").click(function(){

			var id = $(this).attr('data-id');
			var state = $(this).attr('data-state');
			//alert(id);
			if (id) {
				if(confirm("确定收到货款吗？")){
					$.ajax({
						url:"{:U('Trade/order_off')}",
						data:{id:id,state:state,type:'order_off'},
						type:'post',
						dataType:'json',
						success:function (e) {			
						//alert(id);
							alert(e.info); 
							location.reload();				
						}
					});											
				}else{

				//否
				return false;

				}

			} 

		});
    })


</script>
</block>	









